import axios from 'axios'

const serve = axios.create({
    baseURL: 'api'
})


serve.interceptors.response.use(config => {
   return config.data.data
})

export const getJoke = () => {
    serve.post('joke').then(res => {
        console.log(res)    
    })
}

export const login = async () => {
    return await serve.post('login')
}

export const getUserInfo = async (tempUserId: String) => {
    const res = await serve.post('getUserInfo', {
        tempUserId
    }) 
    return res as any
}

